//===============================================================================
// Microsoft patterns & practices
// Web Client Software Factory
//-------------------------------------------------------------------------------
// Copyright (C) Microsoft Corporation.  All rights reserved.
// THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY
// OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT
// LIMITED TO THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
// FITNESS FOR A PARTICULAR PURPOSE.
//-------------------------------------------------------------------------------
// The example companies, organizations, products, domain names,
// e-mail addresses, logos, people, places, and events depicted
// herein are fictitious.  No association with any real company,
// organization, product, domain name, email address, logo, person,
// places, or events is intended or should be inferred.
//===============================================================================
using System;

namespace WCSFContrib.PageFlow
{
	/// <summary>
	/// Defines the interface for an object that can store <see cref="IPageFlow"/>s.
	/// </summary>
	public interface IPageFlowInstanceStore
	{
		/// <summary>
		/// Adds an <see cref="IPageFlow"/> to the store.
		/// </summary>
		/// <param name="pageFlowInstance">The <see cref="IPageFlow"/> to add.</param>
		void Add(IPageFlow pageFlowInstance);

		/// <summary>
		/// Removes an <see cref="IPageFlow"/> from the store.
		/// </summary>
		/// <param name="pageFlowInstance">The <see cref="IPageFlow"/> to remove.</param>
		void Remove(IPageFlow pageFlowInstance);

		/// <summary>
		/// Removed an <see cref="IPageFlow"/> from the store.
		/// </summary>
		/// <param name="id">The unique identifier of the <see cref="IPageFlow"/> to remove from the store.</param>
		void Remove(Guid id);

		/// <summary>
		/// Returns the <see cref="Guid">Guid</see> of the last instance.
		/// </summary>
		/// <returns>The unique identifier of the PageFlow instance.</returns>
        [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1024:UsePropertiesWhereAppropriate")]
        Guid GetLastRunningInstance();

		/// <summary>
		/// Retrieves the unique identifier of an <see cref="IPageFlow">IPageFlow</see> instance 
		/// of the desired <see cref="Type">Type</see>.
		/// </summary>
		/// <param name="type">The <see cref="Type"/> of <see cref="IPageFlow"/> to retrieve.</param>
		/// <returns>The unique idenitifier of an instance of the desired <see cref="Type"/>.</returns>
		Guid GetByType(Type type);

		/// <summary>
		/// Retrieves the instance <see cref="Type">Type</see> assembly qualified full name correspnding to an instance id
		/// </summary>
		/// <param name="id">The <see cref="Guid">Guid</see> of the instance</param>
		/// <returns>The assembly qualified name of the <see cref="Type">Type</see> of the instance or null if not found</returns>
		string GetInstanceType(Guid id);

		/// <summary>
		/// Marks an <see cref="IPageFlow">IPageFlow</see> instance as the currently running instance.
		/// </summary>
		/// <param name="iPageFlow">The <see cref="IPageFlow">IPageFlow</see> instance to mark as running.</param>
		void SetPageFlowRunning(IPageFlow iPageFlow);

		/// <summary>
		/// Marks an <see cref="IPageFlow">IPageFlow</see> instance as not currently running.
		/// </summary>
		/// <param name="iPageFlow">The <see cref="IPageFlow">IPageFlow</see> instance to mark as not currently running.</param>
		void SetPageFlowNotRunning(IPageFlow iPageFlow);
	}
}
